package com.yanfan.energy.service;

import com.yanfan.common.core.domain.AjaxResult;
import com.yanfan.energy.domain.EquipmentConsumption;
import com.yanfan.energy.domain.PurchasingEnergy;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import java.time.LocalDate;
import java.util.List;

/**
 * 设备能耗表(EquipmentConsumption)表服务接口
 *
 * @author makejava
 * @since 2022-10-11 18:16:45
 */
public interface EquipmentConsumptionService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    EquipmentConsumption queryById(Integer id);

    /**
     * 分页查询
     *
     * @param equipmentConsumption 筛选条件
     * @param pageRequest          分页对象
     * @return 查询结果
     */
    Page<EquipmentConsumption> queryByPage(EquipmentConsumption equipmentConsumption, PageRequest pageRequest);

    /**
     * 新增数据
     *
     * @param equipmentConsumption 实例对象
     * @return 实例对象
     */
    EquipmentConsumption insert(EquipmentConsumption equipmentConsumption);

    /**
     * 修改数据
     *
     * @param equipmentConsumption 实例对象
     * @return 实例对象
     */
    EquipmentConsumption update(EquipmentConsumption equipmentConsumption);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(Integer id);

    /**
     * 查询设备能源单调,按能源排序
     *
     * @return
     */
    EquipmentConsumption selectequipmentConsumptionOrderBycreatedDateLimit();

    /**
     * 根据时间排序查询一条关联设备表：find设备编号
     *
     * @return
     */
    EquipmentConsumption selectequipmentConsumptionAndDeviceOrderBycreatedDateLimit();

    /**
     * 查询leftjoin设备,车间
     *
     * @return
     */
    List<EquipmentConsumption> selectOneyly();

    /**
     * 能源报表（按楼宇，能耗分类）查询
     */
    AjaxResult selectenquipmentConsumptionBycondition();


    /**
     * 设备能耗
     *
     * @param buildingId
     * @param workshopIds
     * @param deviceIds
     * @param classifyId
     * @param deviceName
     * @param begin
     * @param end
     * @return
     */
    AjaxResult selectequipmentEnergy(Long buildingId, List<Integer> workshopIds, List<Integer> deviceIds, Integer classifyId, String deviceName, String begin, String end);

    /**
     * 根据时间，设备编号删能源记录表
     *
     * @param time
     * @param id
     */
    void deleteByCreatdateandEquipment(String time, String id);

    AjaxResult addPurchase(PurchasingEnergy purchasingByEnergy);

    AjaxResult deletePurchase(Integer id);

    AjaxResult updatePurchase(PurchasingEnergy purchasingEnergy);

    AjaxResult purchase(String type, String begin, String end, int currPage, int pageSize);

    List<PurchasingEnergy> findAllPurchase(String name, LocalDate begin, LocalDate end);

    AjaxResult purchaseMoneyStat();
}
